import axios from "../../utils/request"

export const confirmOrder = (data:{customerId:number,pickupAddress:string,
  deliveryAddress:string,phoneNumber:string,smallNum:number,mediumNum:number,
  bigNum:number,description:string,code:string}) => {
  return axios({
    url: `http://localhost:8080/orders/add/success`,
    method: "post",
    data
  });
} 
  
export const queryOrders = (data:{page:number,size:number,userId:number,ordersType:number,filterString:number}) => {
  return axios({
    url: `http://localhost:8080/orders/myQuery`, 
    method: 'post',
    data
  });
}

export const cancelOrder = (orderId:number) => {
  return axios({
    url: `http://localhost:8080/orders/delete/receive/${orderId}`,
    method: 'put'
  });
}

export const completeOrder = (orderId:number) => {
  return axios({
    url: `http://localhost:8080/orders/complete/receive/${orderId}`,
    method: 'put'
  });
}

export const completefinishOrder = (orderId:number) => {
  return axios({
    url: `http://localhost:8080/orders/complete/${orderId}`,
    method: 'put'
  });
}

export const deleteOrder = (orderId:number) => {
  return axios({
    url: `http://localhost:8080/orders/delete/${orderId}`,
    method: 'delete'
  });
}

export const  getfinishTime = (orderId:number) => {
  return axios({
    url: `http://localhost:8080/orders/finishTime/${orderId}`,
    method: 'get'
  });
}
 
export const evaluateOrder= (orderId:number,grade:number) => {
  return axios({
    url: `http://localhost:8080/orders/evaluate/${orderId}/${grade}`,
    method: 'put'
  });
}